package com.adwin.addcoin.ui.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.adwin.addcoin.R
import com.adwin.addcoin.databinding.AdapterTaskDetailItemBinding
import com.adwin.addcoin.repository.bean.TaskStage
import com.adwin.addcoin.ui.viewholder.TaskDetailHolder

class TaskDetailItemAdapter(var mContext:Context,var taskStages: List<TaskStage>) : RecyclerView.Adapter<TaskDetailHolder>(){
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TaskDetailHolder {
//        val binding = AdapterTaskDetailItemBinding.inflate(LayoutInflater.from(mContext))
        val view = LayoutInflater.from(mContext).inflate(R.layout.adapter_task_detail_item,parent,false)
        return TaskDetailHolder(view)
    }

    override fun getItemCount(): Int = taskStages.size

    override fun onBindViewHolder(holder: TaskDetailHolder, position: Int) {
        val stage = taskStages[position]
        holder.upDate(stage,position)
    }
}